import type { App } from "vue"
import { createRouter, createWebHistory } from "vue-router"
import { createRouterGuards } from "./guard"
import { staticRoutes } from "./routes"

const router = createRouter({
    history: createWebHistory(),
    routes: staticRoutes,
    strict: true,
    scrollBehavior: () => ({ left: 0, top: 0 })
})

export async function setupRouter(app: App) {
    app.use(router)
    createRouterGuards(router)
    await router.isReady()
}
